package com.easychat.controller;

import com.easychat.annotation.GlobalInterceptor;
import com.easychat.common.PageResult;
import com.easychat.common.Result;
import com.easychat.entity.UserInfoBeauty;
import com.easychat.entity.query.UserInfoBeautyQuery;
import com.easychat.service.UserInfoBeautyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * 靓号表(UserInfoBeauty)表控制层
 *
 * @author makejava
 * @since 2024-10-01 17:32:20
 */
@RestController
@RequestMapping("userInfoBeauty")
public class AdminUserInfoBeautyController {
    /**
     * 服务对象
     */
    @Resource
    private UserInfoBeautyService userInfoBeautyService;

    /**
     * 靓号列表
     * @return
     */
    @GetMapping("/loadBeautyAccountList")
    @GlobalInterceptor(checkAdmin = true)
    public Result<PageResult> queryByPage(UserInfoBeautyQuery query) {
        PageResult pageResult = userInfoBeautyService.queryByPage(query);
        return Result.ok(pageResult);
    }

    /**
     * 添加靓号
     * @param beauty
     * @return
     */
    @PostMapping("/saveBeautyAccount")
    @GlobalInterceptor(checkAdmin = true)
    public Result saveBeautyAccount(UserInfoBeauty beauty) {
        userInfoBeautyService.saveAccount(beauty);
        return Result.ok();
    }

    @PostMapping("/delBeautyAccount")
    @GlobalInterceptor(checkAdmin = true)
    public Result delBeautyAccount(@NotNull Integer id) {
        userInfoBeautyService.deleteById(id);
        return Result.ok();
    }






}

